﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;

namespace XSTDZ.ERP.Infrastructure.Authentication
{
    public class DefaultControlActionInvoker : ControllerActionInvoker
    {
        protected override AuthorizationContext InvokeAuthorizationFilters(ControllerContext controllerContext, IList<IAuthorizationFilter> filters, ActionDescriptor actionDescriptor )
        {
            if (filters == null)
            {
                filters = new List<IAuthorizationFilter>();
            }
            IAuthorizationFilter filter = new AvoidAuthentication(filters, actionDescriptor.ControllerDescriptor.ControllerType, actionDescriptor.ActionName, controllerContext);
            //filters.Clear();//2013/09/03 移出所有的项
            filters.Insert(0, filter);

            return base.InvokeAuthorizationFilters(controllerContext, filters, actionDescriptor);
        }
    }
}
